package com.linciping.useges.plugin.asyc;

import com.linciping.useges.plugin.bean.File2R;
import com.linciping.useges.plugin.bean.PsiFile2Content;

import java.util.List;

public class ProjectResUsegesForSourceCallable extends ResUsegesForSourceCallable {

    private final String moduleName;

    public ProjectResUsegesForSourceCallable(List<File2R> resRList, List<PsiFile2Content> waitFindPsiFileContentList, String moduleName) {
        super(resRList, waitFindPsiFileContentList);
        this.moduleName = moduleName;
    }

    @Override
    protected boolean isHasSpend(String psiFileContent, String constantR) {
        String importPackage = "import " + moduleName + ".R";
        if (psiFileContent.contains(importPackage)) {
            return psiFileContent.contains(constantR);
        } else {
            String realConstantR = moduleName + "." + constantR;
            return psiFileContent.contains(realConstantR);
        }
    }
}
